<?php
// +----------------------------------------------------------------------
// | Author: derek <693472824@qq.com> <http://www.bloveambition.com/>
// +----------------------------------------------------------------------

namespace Blovex4\Controller;

/**
 * 用户意见反馈控制器
 * derek <693472824@qq.com>
 */
class FeedbackController extends AdminController {
    
    /**
     * 配置项-图集首页
     * @author derek <693472824@qq.com>
     */
    public function index() {
        
        /* 查询条件初始化 */
        $map = array();
        
        $type = I('user_type');
        $name = I('name');
        $type = in_array($type, array(1,2)) ? $type : '1';
        $name = empty($name) ? '' : $name;
        $map['user_type'] = $type;
        
        if($type == '1'){
            $model = D('FeedUserView');
            $map['User.username|User.account'] = array('like', '%'.$name.'%');
        }else{
            $model = D('FeedWorkerView');
            $map['Worker.name|Worker.account'] = array('like', '%'.$name.'%');
        }
        
        $list = $this->lists($model, $map, 'feedback_id desc');
        
        $this->assign('list', $list);
        $this->display();
    }
}